package priv.pront.code.lanqiao.competition.course.date0329;

import java.util.Arrays;
import java.util.Scanner;

public class 和为给定数 {
    static int n, m, min = -1, max = -1, left, right;
    static int[] arr;

    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        n = scanner.nextInt();
        arr = new int[n];
        for (int i = 0; i < n; i++) {
            arr[i] = scanner.nextInt();
        }
        m = scanner.nextInt();
        Arrays.sort(arr);
        for (int i = 0; i < n; i++) {
            left = i;
            right = n - 1;
            while (left <= right) {
                int mid = left + (right - left) / 2;
                if (arr[i] + arr[mid] < m) {
                    left = mid + 1;
                } else if (arr[i] + arr[mid] > m) {
                    right = mid - 1;
                } else {
                    if (min == -1) {
                        min = Math.min(arr[i], arr[mid]);
                        max = Math.max(arr[i], arr[mid]);
                    } else {
                        int curMin = Math.min(arr[i], arr[mid]);
                        if (curMin < min) {
                            min = curMin;
                            max = Math.max(arr[i], arr[mid]);
                        }
                    }
                    break;
                }
            }
        }
            if (min != -1) {
                System.out.println(min + " " + max);
            } else {
                System.out.println("No");
            }

    }
}
